import {ref} from 'vue'
import {defineStore} from 'pinia'

export const useCommonStore = defineStore('xjm_commonStore', () => {
        //当前文件夹索引
        let folderIndex = ref(0)
        //刷新界面标识
        let refresh = ref(true)
        //是否显示任务列表
        let isShowTaskList = ref(false)
        //是否打开任务列表
        let isOpenTaskList = ref(false)
        //是否预览
        let isPreview = ref(false)
        //面包屑
        let breadcrumbs: any = ref([])
        //分享文件token
        let shareFileToken: any = ref({})
        //选中的列表想项
        let checkItem: any = ref([])
        //显示分享
        let showShare = ref(false)
        //显示分享
        let shareItemList: any = ref([])
        //分享标题
        let shareTitle = ref('')
        // 搜索列表
        let searchList = ref([])
        // 验证码倒计时时间
        let countDownTime = ref(60)
        return {
            folderIndex,
            refresh,
            breadcrumbs,
            isOpenTaskList,
            isShowTaskList,
            isPreview,
            shareFileToken,
            checkItem,
            showShare,
            shareItemList,
            shareTitle,
            searchList,
            countDownTime
        }
    },
    //开启pinia持久化
    {
        persist: {
            paths: ['folderIndex', 'breadcrumbs', "isOpenTaskList", "shareFileToken", "countDownTime"]
        }
    }
)
